package com.solo.system.web;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.solo.common.core.global.R;
import com.solo.system.model.i18n.type.resp.I18nTypeDataListSimpleAllResp;
import com.solo.system.model.i18n.type.resp.I18nTypeDataListSimpleResp;
import com.solo.system.service.SysI18nTypeDataService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 国际化语言类型数据关联控制器
 * @author 十一
 * @since 2024-10-25 14:19
 * 人生若只如初见，何事秋风悲画扇
 **/
@RestController
@AllArgsConstructor
@RequestMapping("/system/i18n-type-data")
public class SysI18nTypeDataController {

    private final SysI18nTypeDataService sysI18nTypeDataService;

    /**
     * 查询国际化语言类型数据精简信息
     * @return 响应信息
     */
    @GetMapping(value = {"/list-simple/{dataId}", "/list-simple"})
    @SaCheckPermission("system-i18n-type-query")
    public R<List<I18nTypeDataListSimpleResp>> listSimple(@PathVariable(value = "dataId", required = false) Long dataId) {
        return R.success(sysI18nTypeDataService.listSimple(dataId));
    }

    /**
     * 查询国际化语言类型数据精简信息
     * @return 响应信息
     */
    @GetMapping("/list-simple-all")
    @SaCheckPermission("system-i18n-type-query")
    public R<List<I18nTypeDataListSimpleAllResp>> listSimpleAll() {
        return R.success(sysI18nTypeDataService.listSimpleAll());
    }
}
